<!--
描述：
开发人：zhaohang
开发日期：2019年11月15日
-->
<template lang="pug">
  kalix-search(:searchFields="searchFields" title="课程查询" bizKey="liveExamine")
</template>

<script type="text/ecmascript-6">
  export default {
    name: 'liveClassSearch',
    data() {
      return {
        searchFields: [
          {label: '课程名称', prop: 'className'},
          {label: '教师名称', prop: 'teacherId', type: 'select', options: []},
          {label: '', prop: 'isOpen', type: 'inputHidden'}
        ]
      }
    },
    mounted() {
      this.getTeacher()
    },
    methods: {
      getTeacher() {
        this.axios.request({
          method: 'GET',
          url: '/camel/rest/users'
        }).then(res => {
          if (res.data.totalCount > 0) {
            res.data.data.forEach((item) => {
              let arr = {
                value: null,
                label: null
              }
              arr.value = item.id
              arr.label = item.name
              this.searchFields[1].options.push(arr)
            })
          }
        })
      }
    }
  }
</script>

<style scoped lang="stylus" type="text/stylus">

</style>
